#include <stdio.h>
int main ()
{
	int n[6],i,a,rest,num[6],value[6]={1,5,10,50,100,500};
	scanf("%d",&a);
	rest=a; 
	for(i=0;i<6;i++)
        scanf("%d",&n[i]);
    for(i=5;i>=0;i--)
    {
	    num[i]=n[i]>rest/value[i]?rest/value[i]:n[i];
	    rest=rest-value[i]*num[i];
      }
    for(i=0;i<6;i++)
    printf("%3d yuan : %3d ö\n",value[i],num[i]);
  }  
